#ifndef _PUBLISHER_H_
#define _PUBLISHER_H_

#include <string>
#include "staffmqclientexport.h"

namespace staff
{
  class CDataObject;
}

namespace smq
{
  //! Publisher
  /*! class for publishing message into one or more queues */
  class STAFFMQ_CLIENT_EXPORT Publisher
  {
  public:
    Publisher();
    virtual ~Publisher();

    //! initialize publisher
    /*! \param sPublisherName - publisher name
        \param sServerHost - server host
        \param ushServerPort - server port
      */
    void Init(const std::string& sPublisherName, const std::string& sServerHost = "127.0.0.1",
              unsigned short ushServerPort = 8768);

    //! close connection with mqserver and deinitialize publisher
    void Close();

    //! create server queue
    /*! \param sQueueName - queue name
      */
    void CreateQueue(const std::string& sQueueName);

    //! remove server queue
    /*! \param sQueueName - queue name
      */
    void RemoveQueue(const std::string& sQueueName);

    //! publish message into queue
    /*! \param sQueueName - queue name
        \param rMessage - message
      */

    void Publish(const std::string& sQueueName, staff::CDataObject& rMessage);

  private:
    struct PublisherImpl;
    PublisherImpl* m_pImpl;
  };
}

#endif // _PUBLISHER_H_
